package cz.muni.fi.pa165.sme.client.common;

import java.util.List;

import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxNavigationToolbar;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.HeadersToolbar;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider;
import org.apache.wicket.extensions.markup.html.repeater.data.table.NoRecordsToolbar;
import org.apache.wicket.model.ResourceModel;

/**
 * Table with NoRecordsToolbar localized
 *
 * @author jirankova
 */
public class TrackerDataTable<T> extends DataTable<T> {
	private static final int MAX_ROWS_PER_PAGE = 20;

	/**
	 * Constructor
	 *
	 * @param id component id
	 * @param columns list of IColumn objects
	 * @param dataProvider imodel for data provider
	 */
	public TrackerDataTable(final String id, final List<IColumn<T>> columns, final ISortableDataProvider<T> dataProvider) {
		super(id, columns, dataProvider, MAX_ROWS_PER_PAGE);
		setOutputMarkupId(true);
		addTopToolbar(new AjaxNavigationToolbar(this));
		addTopToolbar(new HeadersToolbar(this, dataProvider));
		addBottomToolbar(new NoRecordsToolbar(this, new ResourceModel("noRecords")));
	}
}
